import React from 'react'
import { Arrow, ArrowLeft } from '@react-vant/icons'
import './index.less'
import _tt from '../../utils/tools'
import { NavLink } from 'react-router-dom'

type propTypes = {
  title: string
  rightText: string
  rightUrl: string
  right: any
}

export default function Herader({
  title,
  rightText,
  rightUrl,
  right,
}: propTypes) {
  return (
    <>
      <div className="app-header">
        <div className="app-header-main">
          <div onClick={_tt.goBack}>
            <ArrowLeft />
          </div>
          <div>{title}</div>
          <div>
            {right ? (
              right
            ) : (
              <NavLink to={rightUrl}>
                <span>{rightText}</span>
              </NavLink>
            )}
          </div>
        </div>
      </div>
    </>
  )
}
